//
//  ShowImageController.m
//  Marketing
//
//  Created by Hanen 3G 01 on 16/5/25.
//  Copyright © 2016年 Hanen 3G 01. All rights reserved.
//

#import "ShowImageController.h"

@interface ShowImageController ()

@end

@implementation ShowImageController

- (void)viewDidLoad {
    [super viewDidLoad];
   
  self.navigationItem.leftBarButtonItem = [ViewTool getBarButtonItemWithTarget:self WithAction:@selector(popLastView)];
    self.view.backgroundColor = [UIColor blackColor];
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, KSCreenW, KSCreenW)];
    imageView.backgroundColor = [UIColor blackColor];
    
    [imageView sd_setImageWithURL:[NSURL URLWithString:self.imageUrl] placeholderImage:nil options:SDWebImageRetryFailed progress:^(NSInteger receivedSize, NSInteger expectedSize) {
    UIProgressView * pv = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
        pv.center = imageView.center;
        float currentProgress = (float)receivedSize/(float)expectedSize;
        pv.progress = currentProgress;
    } completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        
    }];
    
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    imageView.center = CGPointMake(KSCreenW / 2.0f, KSCreenH / 2.0f - 64);
    [self.view addSubview:imageView];
    
}
- (void)popLastView
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
    self.tabBarController.hidesBottomBarWhenPushed = YES;
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    self.tabBarController.hidesBottomBarWhenPushed = NO;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
